package com.moetube.web.controller;

import com.moetube.entity.Result;
import com.moetube.upload.feign.UploadFeign;
import com.moetube.video.feign.VideoFeign;
import com.moetube.video.pojo.Video;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * @description: 上传页面
 * @author: Zero
 * @time: 2020/01/03 18:14
 */
@Controller
@RequestMapping("/wupload")
public class UploadController {
    @Autowired
    private UploadFeign uploadFeign;
    @Autowired
    private VideoFeign videoFeign;

    @GetMapping("/toUpload")
    public String toUpload() {
        return "upload";
    }

//    @PostMapping("/upload")
//    @ResponseBody
//    static Result upload(MultipartFile file) {
//        String url = (String) uploadFeign.uploadFile(file).getData();
//        Video video = new Video();
//        video.setVideoUrl(url);
//        videoFeign.add(video);
//        return new Result(true, 20000, "上传视频成功");
//    }
}
